import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.mindview.util.TextFile;

public class E21_WordsInfo {

	public static void main(String[] args) {
		Map<String, Integer> wordsInfo = new HashMap<String, Integer>();

		for (String word : new TextFile("src/E21_WordsInfo.java", "\\W++")) {
			Integer freq = wordsInfo.get(word);
			wordsInfo.put(word, freq == null ? 1 : freq + 1);
		}

		List<String> keys = new ArrayList<String>(wordsInfo.keySet());
		Collections.sort(keys, String.CASE_INSENSITIVE_ORDER);
		for(String key:keys){
			System.out.println(key + "==>" +wordsInfo.get(key));
		}

	}

}
